home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
C-Communications
/
(c)c4.d64
/
mm xmodem.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
6KB
|
208 lines
0 SDRIVE=0:DEL=127:POKE50754,DEL:POKE53280,11:POKE53281,11
10 IFPEEK(9)=0THENPOKE9,1:IFPEEK(49152)<>76THENLOAD"MITEY MO.X1",8,1
15 IFPEEK(9)=1THENPOKE9,2:POKE49315,0:POKE49316,32:LOAD"MITEY MO.X2",8,1
20 POKE50315,96:IFSDRIVETHENPOKE50315,72
25 REM BY ALLAN TEO AND TROY HACKER
30 REM MITEY MO BY DARRELL GRAINGER
35 OPEN5,2,0,CHR$(8)+CHR$(0):GET#5,A$
40 POKE55,00:POKE56,31:MM$="[207]FF"
45 CHT=49313:SPD=49170:CRC=780:SEN=49152
50 REC=SEN+3:TER=REC+3:TYP=TER+3:SUB=TYP+3:DIR=SUB+3:POKECHT,0
55 CS=1.02273E6
60 BR$="0300":GOSUB265
65 PRINTCHR$(14);:POKE650,128:POKE657,128
70 PRINTCHR$(14)"[147][155] MITEY MO/XMODEM 2.5"
75 PRINT" [194]Y [193]LLAN [212]EO AND [196]ARRELL [199]RAINGER"
80 PRINT"[194]AUD [210]ATE: ("+BR$+" [194]AUD) ";
85 IFPEEK(CHT)=1THENPRINT"[196]UPLEX = [200]ALF"
90 IFPEEK(CHT)=0THENPRINT"[196]UPLEX = [198]ULL"
92 PRINT" [195]ARRIER : ";MM$;"[146]"
95 PRINT" 1 - [212]ERMINAL MODE ([193]SCII)"
100 PRINT" 2 - [212]RANSMIT A FILE ([195]HECK/[195]RC)"
105 PRINT" 3 - [210]ECEIVE A FILE ([195]HECKSUM MODE)"
110 PRINT" 4 - [210]ECEIVE A FILE ([195][210][195][160]MODE)"
115 PRINT" 5 - [212]OGGLE [194]AUD [210]ATE (300-1200)"
120 PRINT" 6 - [212]YPE SEQ FILE"
125 PRINT" 7 - [208]RINT A FILE"
130 PRINT" 8 - [196]IRECTORY"
135 PRINT" 9 - [196]UPLEX"
140 PRINT" 0 - [206]OTES"
145 PRINT" + - [196]UMP CAPTURE BUFFER"
150 PRINT" - - [195]LEAR CAPTURE BUFFER"
155 PRINT" _ - [209]UIT PROGAM"
160 PRINT" \ - [193]UTODIAL [205]ITEY [205]O"
170 PRINT" [197]XIT USING _ ONLY"
175 GETA$:IFA$=""THEN175
180 IFA$="5"THEN295
185 IFA$="1"THEN310
190 IFA$="2"THEN335
195 IFA$="3"THEN365
200 IFA$="4"THEN375
205 IFA$="6"THEN410
210 IFA$="7"THEN420
215 IFA$="8"THEN440
220 IFA$="9"THEN500
225 IFA$="0"THEN640
230 IFA$="+"THEN560
235 IFA$="-"THEN610
240 IFA$="\"THEN770
250 IFA$="_"THENPOKE49152,0:PRINTTAB(1);:POKE56,160:END
255 GOTO175
260 REM *** RS 232 TIMING ***
265 S=VAL(BR$):POKE659,6:IFS=1200THENPOKE659,8
270 RC=CS/S:GOSUB290:POKESPD,LO:POKESPD+1,HI
275 IFS=1200THENRC=CS/S*.966:GOSUB290
280 POKE665,LO:POKE666,HI
285 RC=CS/S/2-100:GOSUB290:POKE661,LO:POKE662,HI:RETURN
290 HI=INT(RC/256):LO=INT(RC-HI*256):RETURN
295 IFBR$="1200"THENBR$="0300":GOTO305
300 BR$="1200"
305 GOSUB265:GOTO70
310 MM$="[207]N":SYS679:GOSUB515:PRINTCHR$(14);"[147]":GOTO325
315 REM TERMINAL
320 GOSUB515
325 PRINT:PRINT:PRINT" [208]RESS [198]2 FOR HELP":SYSTER:
330 GOSUB 525:GOTO70
335 PRINT:PRINT " [212]RANSMIT A FILE":INPUT " [198]ILENAME";F$:T$=""
340 INPUT " [198]ILETYPE [211],[208],[213]";T$:IFT$=""THENPRINT"[145]";:GOTO340
345 CLOSE6:CLOSE3:OPEN3,8,2,"0:"+F$+","+T$+",R"
350 GOSUB 470 'GET ERROR CHAN
355 POKE667,PEEK(668):POKE669,PEEK(670)
360 SYSSEN:GOSUB530:GOTO315
365 PRINT:PRINT" [210]ECEIVE [198]ILE [195]HECKSUM [205]ODE"
370 GOSUB385:POKECRC,0:SYSREC:GOSUB530:GOTO315 :REM RECEIVE CHECKSUM MODE
375 PRINT:PRINT" [210]ECEIVE [198]ILE [195][210][195] [205]ODE"
380 GOSUB385:POKECRC,1:SYSREC:GOSUB530:GOTO315 :REM CRC RECEIVE MODE
385 PRINT:INPUT " [198]ILENAME";F$:T$=""
390 INPUT " [198]ILE TYPE [211],[208],[213] ";T$:CLOSE3:CLOSE6:IFT$=""THENPRINT"[145]";:GOTO390
395 OPEN3,8,2,"0:"+F$+","+T$+",W"
400 GOSUB 470
405 RETURN
410 REM * TYPE A FILE
415 GOSUB515:PRINT"[147]";:SYSTYP:GOSUB450:GOSUB525:GOTO70
420 REM * PRINT A FILE
425 PRINT:PRINT"[193]LL FILES WITH A .LIS EXTENTION WILL BE PRINTED IN ";
430 PRINT "[197]PSON CONDENSE MODE"
435 SYSSUB:GOSUB450:GOTO70
440 REM * (null)
445 SYSDIR:GOSUB450:GOTO70
450 REM * WAIT FOR USER TO PRESS KEY
455 PRINT:PRINT"[208]RESS ANY KEY TO CONTINUE":POKE198,0
460 GETA$:IFA$=""THEN460
465 RETURN
470 REM CHECK DISK ERROR CHAN
475 OPEN6,8,15:INPUT#6,E$,A$,B$,C$
480 IFE$="00"THENRETURN
485 PRINT:PRINT" [196]ISK [197]RROR"
490 PRINT" "E$;" "A$;" "B$;" "C$
495 GOSUB 450:GOTO70
500 REM DUPLEX
505 IF PEEK(CHT)=0THENPOKECHT,1:GOTO70
510 IF PEEK(CHT)=1THENPOKECHT,0:GOTO70
515 REM CHANGE CHARSET
520 RETURN
525 RETURN
530 FORX=1TO4
535 S=54272:FORL=0TO24:POKES+L,0:NEXT
540 POKES+1,130:POKES+5,9:POKES+15,30:POKES+24,15:FORT=1TO12:POKES+4,29:NEXT
545 FORT=1TO70:NEXT: POKES+4,29
550 NEXTX:POKES+24,0:
555 RETURN
560 REM DUMP BUFFER
565 PRINT" [196]UMP BUFFER "
570 PRINT " DISK SCREEN "
575 GETO$:IFO$=""THEN575
580 IFO$="S"THEN595
585 IFO$="D"THEN605
590 GOTO 575
595 GOSUB515:PRINT"[147]":GOSUB450
600 POKE808,239:POKE49318,0:SYS51749:GOSUB450:POKE808,237:GOSUB525:GOTO70
605 POKE49318,1:GOSUB385:SYS51749:GOSUB450:GOTO70
610 REM CLR BUFFER
615 PRINT" [195]LEAR[160]BUFFER":PRINT:PRINT" [193]RE YOU SURE [217]/[206]";
620 GETA$:IFA$=""THEN620
625 IFA$="Y"ORA$="[217]"THEN635
630 GOTO70
635 C=49314:POKEC,0:POKEC+1,0:POKEC+2,32:PRINT:GOTO70
640 REM NOTES
645 GOSUB515:
650 PRINT"[147][201]F YOU ARE USING [201][197][197][197] DEVICES THEN SET 'SDRIVE' TO 0 OTHERWISE ";
655 PRINT"SET IT TO 1.":PRINT"[195]HANGE 'DEL' TO 8 OR 127."
660 PRINT"[212]HESE VARIABLES ARE FOUND AT THE BEGINNING OF THE PROGRAM."
665 PRINT"[212]O STOP CAPTURE DUMP PRESS 'STOP KEY'."
670 PRINT"[212]O TURN THE CARRIER OFF AND HANGUP USE"
672 PRINT"THE '\' KEY THEN 'F7' TO ABORT."
673 PRINT "[201]F 'DEL' EQUALS 127 YOU MAY HAVE TO":PRINT"USE [211][200][201][198][212] TO USE IT OR";
674 PRINT" USE [195][212][210][204]-H FOR A [196][197][204][197][212][197] KEY."
675 PRINT "[215]ITH THANKS TO [212]ROY [200]ACKER":PRINT"AND [211]TEVE [208]UNTER":PRINT
680 PRINT"** [212]HIS PROGRAM IS [208][213][194][204][201][195] [196][207][205][193][201][206] **[146]"
685 GOSUB450:GOSUB525:GOTO70
690 REM **** SOUND ROUTINE ****
695 SO=54272
700 POKESO+1,250
705 POKESO+5,10
710 POKESO+15,200
715 POKESO+24,15
720 FORCL=1TO256
725 POKESO+4,21
730 NEXTCL
735 POKESO+4,20
740 GETB$:IFB$=""THEN700
745 SO=54272
750 FORCL=0TO144
755 POKESO+CL,0
760 NEXTCL
765 GOTO310
770 REM AUTO-DIAL
780 PRINT"[147] [205]ITEY [205]O [193]UTO-[196]IAL[160][205]ODE"CHR$(13):MM$="[207]FF":SYS728
785 POKE56577,32:POKE56579,00:REM HANG UP
790 PRINT" [211]ET [214]-[196] SWITCH TO [196] [146] - <F7> [193]BORTS!"
795 PRINT"[197]NTER [206]UMBER TO [196]IAL:";:ND$="1-":PRINT" ";
800 GETNN$
805 IFNN$=CHR$(136)THEN70
810 IFNN$=CHR$(13)THEN840
815 IFNN$=CHR$(20)ANDLEN(ND$)<1THEN800
820 IFNN$=CHR$(20)THENND$=LEFT$(ND$,LEN(ND$)-1):PRINTNN$;:GOTO800
825 IF(NN$>="0"ANDNN$<="9")OR(NN$="-")THENND$=ND$+NN$:PRINTNN$;:NN$=""
830 GOTO800
840 PRINT:PRINT" [197]NTER '0' [198]OR [195]ONSTANT [210]EDIALING"
845 PRINT:INPUT"[197]NTER [210]EDIAL [212]IMES 0[157][157][157]";XT$:XT=VAL(XT$):TX=0
850 INPUT"[204]ENGTH OF WAIT FOR [195]ARRIER [196]ETECT 12[157][157][157][157]";WA
855 IFNN$=CHR$(136)THEN70
860 POKE56579,00:POKE56577,32:REM HANG UP
865 FORQQ=1TO65
870 GETA$:IFA$=CHR$(136)THENGOSUB1025:GOTO70
875 NEXT
880 POKE56579,38:REM PICK UP PHONE
885 FORQQ=1TO200:NEXT
890 PRINT"[147]"
895 PRINT" <F7> [193]BORTS!"
900 TX=TX+1:PRINTSPC(30)"[212]RY:"TX
905 LN=LEN(ND$):MM=1:PRINT"[145][196]IALING:";
910 VV$=MID$(ND$,MM,1):IFMM<>1THENPRINT""VV$"";
915 IFVV$="-"THENGOSUB1025:GOTO945
920 VV=VAL(VV$):IFVV=0THENVV=10
925 FORMV=1TOVV
930 POKE56577,32:FORQQ=1TO45:NEXT:POKE56577,04:FORQQ=1TO50:NEXT:REM PULSE
935 NEXTMV:REM NEXT PULSE
940 GOSUB1025
945 MM=MM+1:IFMM<=LNTHEN910
955 REM CARRIER DETECT
960 MM=0:PRINT:PRINT" [215]AITING [198]OR [195]ARRIER"
965 POKE 56579,38:POKE56577,06:REM PICK UP PHONE AND START CARRIER LOW
970 GOSUB1025:REM HI/LO DELAY
975 IFPEEK(56577)=207THEN1035
980 IFPEEK(56577)=223THENPOKE56577,06
985 IFPEEK(56577)=207THEN1035
990 IFPEEK(56577)=223THENPOKE56577,06
995 GETA$:IFA$=CHR$(136)THEN1015
1000 MM=MM+1:IFMM<WATHEN970
1005 PRINT" [206]O [195]ARRIER [196]ETECTED":POKE56577,32:POKE56579,00:REM HANGUP
1010 IFTX<>XTTHENGOTO855
1015 PRINT" [200]ANGING [213]P [208]HONE ":POKE56577,32:POKE56579,00
1020 FORQQ=1TO1000:NEXT:GOTO70
1025 FORCC=1TO650:NEXT:RETURN
1030 RETURN
1035 IFPEEK(56577)=207THEN690
1040 MM=WA:GOTO1000